package cn.peach.feign.clients;

import cn.peach.domain.User;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserFeignClientFallbackFactory implements FallbackFactory<UserFeignClient> {

    @Override
    public UserFeignClient create(Throwable throwable) {
        return new UserFeignClient() {

            @Override
            public User getById(Long id) {
                throwable.printStackTrace();
                return new User(-1L, "", "获取用户服务失败");
            }
        };
    }
}
